﻿using AutoMapper;
using AutoMapper.Data;
using AutoMapper.Mappers;
using SqlServerMaintenanceSolution.Models;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SqlServerMaintenanceSolution.ViewModels
{
    public static class InitializeAutoMapper
    {
        public static void Initialize()
        {
            Mapper.Initialize(cfg =>
            {
                MapperRegistry.Mappers.Add(new DataReaderMapper());
                // Other config

            });

            CreateModelsToViewModels();
            CreateViewModelsToModels();
        }

        private static void CreateModelsToViewModels()
        {
            Mapper.CreateMap<IDataReader, DataBase>();
            Mapper.CreateMap<IDataReader, DatabaseFileDetail>();
            Mapper.CreateMap<IDataReader, DatabaseIndexDetail>();
        }

        private static void CreateViewModelsToModels()
        {
            //Mapper.CreateMap<CategoriesViewModel, Categoies>()
            //    .ForMember(c => c.CategoryPositions, option => option.Ignore())
            //    .ForMember(c => c.Posts, option => option.Ignore());
        }
    }
}
